/**
 * Created by no1 on 2015/8/7.
 */
'use strict';
var DaoBase = require('./DaoBase');
var db = require('./models');
var F = require('../../function');

var util = require("util");

function WareVersionDao(data) {
  data = data || {}
  data.model = data.model || db.wareVersion;
  this.data = data;
  DaoBase.call(this, data);
}

util.inherits(WareVersionDao, DaoBase);

/**
 * @todo 连表查询
 * @param id
 * @param opt
 * @returns {{error, msg, data}|{error, msg}}
 */
WareVersionDao.prototype.getOneByPopulate = function*(id, opt) {
  var ret = yield this.model.findOne({id: id}).populate('shops.shopInfo');//_id 2423dff34rd2324 id 112
  return F.returnData(0, 'ok', ret._doc)
};

module.exports = WareVersionDao;